#ifndef VM_MMAP_H
#define VM_MMAP_H

#include <hash.h>

typedef int mapid_t;//identify map

struct vm_mfile
{
  mapid_t mapid;
  int fid;                     //File descriptor.
  struct hash_elem hash_elem;  //Hash element for the hash frame table.
  struct list_elem thread_elem;//List elem for a thread's mfile list.
  //User virtual address of start and end of the mapped file as it might span on multiple pages.
  void *start_addr;            
  void *end_addr;
};

void vm_mfile_init (void);//Initialise the memory mapped files table.
//Memory mapped files functions.
struct vm_mfile *vm_find_mfile (mapid_t);
void vm_insert_mfile (mapid_t, int, void *, void *);
bool vm_delete_mfile (mapid_t);

#endif /* vm/mmap.h */
